﻿@{
    ViewBag.Title = "Default Button - Ext.NET MVC Examples";
    Layout = "~/Views/Shared/_BaseLayout.cshtml";
    var X = Html.X();
}

@section example 
{
    @(X.Container()
        .Layout(LayoutType.VBox)
        .Height(650)
        .Items(
            X.FormPanel()
                .Title("Last Button by default")
                .BodyPadding(5)
                .Width(350)
                .Items(
                    X.TextField()
                        .FieldLabel("Item 1"),
                    X.TextField()
                        .FieldLabel("Item 2")
                )
                .Buttons(
                    X.Button().
                        Text("Button 1"),
                    X.Button()
                        .Text("Button 2")
                        .OnClientClick("Ext.Msg.alert('ENTER', 'ENTER is intercepted by Button2');")
                ),
                
            X.FormPanel()
                .Title("Button by Index")
                .DefaultButton("1")
                .BodyPadding(5)
                .Width(350)
                .Items(
                    X.TextField()
                        .FieldLabel("Item 1"),
                    X.TextField()
                        .FieldLabel("Item 2")
                )
                .Buttons(
                    X.Button().
                        Text("Button 1"),
                    X.Button()
                        .Text("Button 2")
                        .OnClientClick("Ext.Msg.alert('ENTER', 'ENTER is intercepted by Button2');"),
                    X.Button().
                        Text("Button 3"),
                    X.Button().
                        Text("Button 4")
                ),
                
            X.FormPanel()
                .Title("Button by ID")
                .DefaultButton("Button2")
                .BodyPadding(5)
                .Width(350)
                .Items(
                    X.TextField()
                        .FieldLabel("Item 1"),
                    X.TextField()
                        .FieldLabel("Item 2")
                )
                .Buttons(
                    X.Button().
                        Text("Button 1"),
                    X.Button()
                        .Text("Button 2")
                        .ID("Button2")
                        .OnClientClick("Ext.Msg.alert('ENTER', 'ENTER is intercepted by Button2');"),
                    X.Button().
                        Text("Button 3"),
                    X.Button().
                        Text("Button 4")
                ),
                
            X.FormPanel()
                .Title("Button by Selector")
                .DefaultButton("button[text=Button 2]")
                .BodyPadding(5)
                .Width(350)
                .Items(
                    X.TextField()
                        .FieldLabel("Item 1"),
                    X.TextField()
                        .FieldLabel("Item 2")
                )
                .Buttons(
                    X.Button().
                        Text("Button 1"),
                    X.Button()
                        .Text("Button 2")
                        .OnClientClick("Ext.Msg.alert('ENTER', 'ENTER is intercepted by Button2');"),
                    X.Button().
                        Text("Button 3"),
                    X.Button().
                        Text("Button 4")
                )
        )
    )
}
